목차
관련 리팩토링
Encapsulate variable
Split variable
Slide statements
Extract function
Separate query from modifier
Remove setting method
Replace derived variable with query
Combine functions into class
Combine functions into transform
Change reference to value
함수형 프로그래밍
변하는 데이터 그 자체를 문제의 원인으로 보는 접근:
“
For this reason, an entire school of software development—functional programming —is based on the notion that data should never change and that updating a data structure should always return a new copy of the structure with the change, leaving the old data pristine. —Chapter 3, Refactoring: Improving the design of existing code
(모든 함수형 프로그래밍이 변수를 허용하지 않는 건 아니다.)
목차 관련 글 Why functional programming matters “Functional languages push those limits back.” 전역 데이터 “Global data is especially nasty when it’s mutable.” 데이터 클래스 관련 절: 예외 긴 함수 관련 절: 함수를 작게 나누면 생기는 문제들에 대해 프로그래밍 패러다임 “In turn, a functional programming language is one that supports and encourages the functional style….” 리팩토링 “In essence, when you refactor, you are improving the design of the code after it has been written.” 주석 관련 절: 방향제 또는 데오데란트 Denotational semantics “This turned out to be an important observation that not only gave denotational semantics a new lease on life an…” Roles of variables framework “Fixed value: A variable whose value does not change after initialization plays the role of a fixed value.” 데이터 뭉텅이 “Bunches of data that hang around together really ought to find a home together. --Chapter 3, Refactoring: Impro…” Feature envy “We’ve lost count of the times we’ve seen a function invoking half-a-dozen getter methods on another object to c…” 거부당한 유산 관련 절: 약한 냄새 신비로운 이름 관련 절: 더 깊은 디자인 문제의 증상 코드 중복 관련 절: 중복된 코드의 비용 Programmer's brain “In most cases, refactoring is done to make it easier to maintain the resulting code….” 정적 프로그램과 동적 프로세스 “심지어 몇몇 언어(주로 함수형 언어)에서는 변수의 값도 불변으로 제약한다.” 시각적 질의와 데이터 시각화 주제어가 겹침 Lambda calculus “The only bound variable is the single , so applying this function to 2 return 2.” 린 (프로그래밍 언어) “Lean is a functional programming language that makes it easy to write correct and maintainable code.” Dependency inversion “함수형 프로그래밍에서는 고차 함수, 객체지향프로그래밍에서는 다형성으로 의존성을 뒤집는다.”